package com.ayoka.ui.launch;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.view.WindowManager;

import com.ayoka.R;
import com.ayoka.adapter.GuidePagerAdapter;
import com.ayoka.base.BaseActivity;
import com.ayoka.base.BasePresenter;
import com.ayoka.databinding.ActivityGuideBinding;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

/**
 * =========================================================
 * 作者： 金春平
 * 类名： GuideActivity
 * 类描述：
 * 创建日期 17/03/30
 * =========================================================
 */
public class GuideActivity extends BaseActivity<ActivityGuideBinding, BasePresenter> {

    public static void start(Activity activity) {
        Intent intent = new Intent(activity, GuideActivity.class);
        activity.startActivity(intent);
    }

    private List<Integer> data = new ArrayList<>(Arrays.asList(R.drawable.guide_swip_1, R.drawable.guide_swip_2, R.drawable.guide_swip_3, R.drawable.guide_swip_4));


    @Override
    protected void onBeforeSetContentLayout() {
        super.onBeforeSetContentLayout();
        getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
    }


    @Override
    public int getContentLayout() {
        return R.layout.activity_guide;
    }

    @Override
    protected void initViews() {
        mDataBinding.viewPager.setAdapter(new GuidePagerAdapter(this, data) {
            @Override
            protected View.OnClickListener getListener() {
                return new View.OnClickListener() {
                    @Override
                    public void onClick(View v) {
                        LaunchActivity.start(GuideActivity.this);
                        finish();
                    }
                };
            }
        });
        mDataBinding.viewPager.setOffscreenPageLimit(data.size());
        mDataBinding.circleIndicator.setViewPager(mDataBinding.viewPager);
    }


    @Override
    public void initData(Bundle savedInstanceState) {
    }


    @Override
    public void onBackPressed() {
    }

    @Override
    public BasePresenter getPresenter() {
        return null;
    }
}
